home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / PRINTER.CC < prev    next >
C/C++ Source or Header  |  1993-04-04  |  2KB  |  98 lines

  1. #include <tcutil.h>
  2. #include <conio.h>
  3.  
  4.  
  5. print_init(int lptnum)
  6. /* Initialize the printer identified by lptnum. lptnum = 1-3 */
  7. {
  8.     return(biosprint(1,0,lptnum - 1) & 0x29);
  9. }
  10.  
  11. print_stat(int lptnum)
  12. /* query the status of the printer attached as lptnum. lptnum = 1-3.
  13.     RETURNED = 0 if printer is ready for work.
  14.              = 1 if printer is not ready.
  15. */
  16. {
  17. int rc, rc2, ocol, orow;
  18. char opt;
  19. char saver[740];
  20.     rc2=0;
  21.     ocol=wherex();
  22.     orow=wherey();
  23.     window(29,7,65,16);
  24.     gettext(29,7,65,16,saver);
  25.     textbackground(blue);
  26.     textcolor(white);
  27.     highvideo();
  28. ptype_ok:
  29.     rc=biosprint(2,0,lptnum - 1);
  30.     if(rc & 0x2f || !rc) {
  31.         clrscr();
  32.         gotoxy(12,1);
  33.         cprintf("[PRINTER ERROR]");
  34.         gotoxy(12,10);
  35.         cprintf("[ESC TO EXIT]");
  36.         gotoxy(2,3);
  37.         cprintf("The Printer is not responding.");
  38.         gotoxy(2,4);
  39.         cprintf("Make sure you entered the correct");
  40.         gotoxy(2,5);
  41.         cprintf("printer number, that the printer");
  42.         gotoxy(2,6);
  43.         cprintf("power is on, and it has paper.");
  44.         gotoxy(2,7);
  45.         cprintf("Press a space bar to retry or");
  46.         gotoxy(2,8);
  47.         cprintf("Press ESC to cancel print.");
  48.         get_akey(&opt," \x1b");
  49.         if(opt=='\x1b') {
  50.             rc2=1;
  51.             goto end_it;
  52.         }
  53.         goto ptype_ok;
  54.     }
  55. end_it:
  56.     puttext(29,7,65,16,saver);
  57.     window(1,1,80,25);
  58.     textbackground(black);
  59.     textcolor(cyan);
  60.     gotoxy(ocol,orow);
  61.     return(rc2);
  62. }
  63.  
  64.  
  65.  
  66. print_str(char *str, int lptnum)
  67. /* Print the string pointed to by *str on printer lptnum where
  68.    lptnum = 1-3.
  69.    RETURNED = 0 if ok.
  70.             = 1 if error.
  71. */
  72. {
  73.     int rc;
  74.  
  75.     while(*str) {
  76.         rc=biosprint(0,*str,lptnum - 1);
  77.         if(rc & 0x29) return(1);
  78.         str++;
  79.     }
  80.     return(0);
  81. }
  82.  
  83.  
  84.  
  85. print_char(char ch, int lptnum)
  86. /* Print the character ch on printer lptnum where lptnum = 1-3.
  87.    RETURNED = 0 if ok.
  88.             = 1 if error.
  89. */
  90. {
  91.     int rc;
  92.  
  93.     rc=biosprint(0,ch,lptnum - 1);
  94.     if(rc & 0x29) return(1);
  95.     return(0);
  96. }
  97.  
  98.